import java.util.*;

/**
 * @author yexy
 * @date 2020/6/15 12:59 下午
 * @description
 */
//扑克类
public class Poker {

    //初始化普通牌
    private ArrayList<Card> normalGroup = new ArrayList<>(Arrays.asList(
            new Card("3",3),
            new Card("4",4),
            new Card("5",4),
            new Card("6",5),
            new Card("7",6),
            new Card("8",8),
            new Card("9",9),
            new Card("10",10),
            new Card("J",11),
            new Card("Q",12),
            new Card("K",13),
            new Card("A",15),
            new Card("2",16)));
    //初始化大王，小王
    private  ArrayList<Card> specialGroup = new ArrayList<>(Arrays.asList(
            new Card("小王",17),
            new Card("大王",18)));


    private ArrayList<Card> cards = new ArrayList<>();

    public Poker(){

        //初始化 54张牌
        cards.addAll(new ArrayList<>(normalGroup));
        cards.addAll(new ArrayList<>(normalGroup));
        cards.addAll(new ArrayList<>(normalGroup));
        cards.addAll(new ArrayList<>(normalGroup));
        cards.addAll(specialGroup);
    }

    //获取牌堆
    public ArrayList<Card> getCards() {
        return cards;
    }

    //根据Card的value降序排序
    public List<Card> sort(List<Card> cards) {
        cards.sort(new Comparator<Card>() {
            @Override
            public int compare(Card o1, Card o2) {
                return o2.getValue() - o1.getValue();
            }
        });
        return cards;
    }


}
